var assert = require("assert")
var _ = require("rosa/html4")
var renderer = require("rosa/html4Render")
var renderPart = renderer.renderPart

var template = require("rosa/template")

var $ = exports

var checkTemplate = function(p) {
	return function() {
		var templateFun = template.generate(p.template, p.separator)
		var specialized = templateFun(p.params)
		assert.equal(p.expected, renderPart(specialized))
	}
}

$.testContent = checkTemplate({
	template: "<a>$$a$$</a><b>$$b$$</b>",
	params: {	a: _.div("AAA"), b: "bb",	c: "cc"	},
	expected: "<a><div>AAA</div></a><b>bb</b>"
}) 

$.testOtherSeparator = checkTemplate({
	template: "<a>_a_</a>",
	params: {	a: "AAA" },
	separator: "_",
	expected: "<a>AAA</a>"
}) 
